package com.umeng.fb.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.umeng.common.b.g;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class c
{
  // ERROR //
  public static String a(Context paramContext, JSONArray paramJSONArray)
  {
    // Byte code:
    //   0: ldc 2
    //   2: monitorenter
    //   3: aload_1
    //   4: ifnull +10 -> 14
    //   7: aload_1
    //   8: invokevirtual 18	org/json/JSONArray:length	()I
    //   11: ifne +11 -> 22
    //   14: ldc 20
    //   16: astore_2
    //   17: ldc 2
    //   19: monitorexit
    //   20: aload_2
    //   21: areturn
    //   22: ldc 20
    //   24: astore_2
    //   25: iconst_0
    //   26: istore 4
    //   28: aload_1
    //   29: invokevirtual 18	org/json/JSONArray:length	()I
    //   32: istore 5
    //   34: iload 4
    //   36: iload 5
    //   38: if_icmpge -21 -> 17
    //   41: aload_1
    //   42: iload 4
    //   44: invokevirtual 24	org/json/JSONArray:getJSONArray	(I)Lorg/json/JSONArray;
    //   47: astore 7
    //   49: iconst_0
    //   50: istore 8
    //   52: iload 8
    //   54: aload 7
    //   56: invokevirtual 18	org/json/JSONArray:length	()I
    //   59: if_icmplt +6 -> 65
    //   62: goto +89 -> 151
    //   65: aload 7
    //   67: iload 8
    //   69: invokevirtual 28	org/json/JSONArray:getString	(I)Ljava/lang/String;
    //   72: ldc 30
    //   74: invokevirtual 36	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   77: ifeq +6 -> 83
    //   80: goto +77 -> 157
    //   83: aload 7
    //   85: iload 8
    //   87: invokevirtual 40	org/json/JSONArray:getJSONObject	(I)Lorg/json/JSONObject;
    //   90: astore 9
    //   92: ldc 42
    //   94: aload 9
    //   96: ldc 44
    //   98: invokevirtual 50	org/json/JSONObject:optString	(Ljava/lang/String;)Ljava/lang/String;
    //   101: invokevirtual 54	java/lang/String:equalsIgnoreCase	(Ljava/lang/String;)Z
    //   104: ifeq +53 -> 157
    //   107: aload_0
    //   108: aload 9
    //   110: invokestatic 58	com/umeng/fb/util/c:b	(Landroid/content/Context;Lorg/json/JSONObject;)Z
    //   113: ifeq +44 -> 157
    //   116: aload_0
    //   117: aload 9
    //   119: ldc 60
    //   121: invokevirtual 50	org/json/JSONObject:optString	(Ljava/lang/String;)Ljava/lang/String;
    //   124: invokestatic 64	com/umeng/fb/util/c:d	(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
    //   127: astore 10
    //   129: aload 10
    //   131: astore_2
    //   132: goto +25 -> 157
    //   135: astore 6
    //   137: aload 6
    //   139: invokevirtual 67	java/lang/Exception:printStackTrace	()V
    //   142: goto +9 -> 151
    //   145: astore_3
    //   146: ldc 2
    //   148: monitorexit
    //   149: aload_3
    //   150: athrow
    //   151: iinc 4 1
    //   154: goto -126 -> 28
    //   157: iinc 8 1
    //   160: goto -108 -> 52
    //
    // Exception table:
    //   from	to	target	type
    //   41	49	135	java/lang/Exception
    //   52	62	135	java/lang/Exception
    //   65	80	135	java/lang/Exception
    //   83	129	135	java/lang/Exception
    //   7	14	145	finally
    //   28	34	145	finally
    //   41	49	145	finally
    //   52	62	145	finally
    //   65	80	145	finally
    //   83	129	145	finally
    //   137	142	145	finally
  }

  public static List<com.umeng.fb.b> a(Context paramContext)
  {
    ArrayList localArrayList;
    monitorenter;
    try
    {
      localArrayList = new ArrayList();
    }
    finally
    {
      try
      {
        Iterator localIterator = paramContext.getSharedPreferences("feedback", 0).getAll().values().iterator();
        boolean bool = localIterator.hasNext();
        if (!(bool))
        {
          label49: monitorexit;
          return localArrayList;
        }
        localArrayList.add(new com.umeng.fb.b(new JSONArray((String)localIterator.next())));
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        break label49:
        localObject = finally;
        monitorexit;
        throw localObject;
      }
    }
  }

  public static void a(Context paramContext, com.umeng.fb.b paramb, int paramInt)
  {
    monitorenter;
    while (true)
    {
      SharedPreferences.Editor localEditor;
      String str1;
      String str2;
      int j;
      try
      {
        SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("feedback", 0);
        localEditor = localSharedPreferences.edit();
        label95: str2 = localSharedPreferences.getString(str1, null);
      }
      finally
      {
        try
        {
          JSONArray localJSONArray1 = new JSONArray();
          JSONArray localJSONArray2 = new JSONArray(str2);
          int i = localJSONArray2.length();
          j = 0;
          if (i == 1)
          {
            localEditor.remove(paramb.c);
            localEditor.commit();
            paramb.b(paramInt);
            monitorexit;
            return;
          }
          do
          {
            if (j == paramInt)
              break label172;
            localJSONArray1.put(localJSONArray2.getJSONObject(j));
            break label172:
          }
          while (j <= -1 + localJSONArray2.length());
          localEditor.putString(str1, localJSONArray1.toString());
        }
        catch (JSONException localJSONException)
        {
          localJSONException.printStackTrace();
          break label95:
          localObject = finally;
          monitorexit;
          throw localObject;
        }
      }
      label172: ++j;
    }
  }

  public static void a(Context paramContext, String paramString)
  {
    int j;
    monitorenter;
    try
    {
      String[] arrayOfString;
      Object localObject2;
      SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("UmengFb_Nums", 0);
      if (!(g.c(paramString)))
      {
        arrayOfString = localSharedPreferences.getString("newReplyIds", "").split(",");
        int i = arrayOfString.length;
        localObject2 = "";
        j = 0;
        if (j < i)
          break label66;
        a(localSharedPreferences, "newReplyIds", (String)localObject2);
      }
      return;
      label66: String str1 = arrayOfString[j];
      if ((!(g.c(str1))) && (!(str1.equals(paramString))))
      {
        String str2 = localObject2 + "," + str1.trim();
        localObject2 = str2;
      }
    }
    finally
    {
      monitorexit;
    }
  }

  public static void a(Context paramContext, String paramString1, String paramString2)
  {
    monitorenter;
    try
    {
      paramContext.getSharedPreferences(paramString1, 0).edit().remove(paramString2).commit();
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  private static void a(SharedPreferences paramSharedPreferences, String paramString1, String paramString2)
  {
    monitorenter;
    try
    {
      paramSharedPreferences.edit().putString(paramString1, paramString2).commit();
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  public static boolean a(Context paramContext, com.umeng.fb.b paramb)
  {
    return paramContext.getSharedPreferences("UmengFb_Nums", 0).getString("newReplyIds", "").contains(paramb.c);
  }

  public static boolean a(Context paramContext, JSONObject paramJSONObject)
  {
    monitorenter;
    try
    {
      String str = paramJSONObject.optString("feedback_id");
      SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("feedback", 0);
      boolean bool = g.c(str);
      int i = 0;
      if (!(bool))
      {
        a(localSharedPreferences, str, "[" + paramJSONObject.toString() + "]");
        i = 1;
      }
      return i;
    }
    finally
    {
      monitorexit;
    }
  }

  public static com.umeng.fb.b b(Context paramContext, String paramString)
  {
    String str;
    monitorenter;
    try
    {
      str = paramContext.getSharedPreferences("feedback", 0).getString(paramString, null);
    }
    finally
    {
      com.umeng.fb.b localb;
      try
      {
        localb = new com.umeng.fb.b(new JSONArray(str));
        label35: monitorexit;
        return localb;
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        localb = null;
        break label35:
        localObject = finally;
        monitorexit;
        throw localObject;
      }
    }
  }

  // ERROR //
  public static boolean b(Context paramContext, JSONObject paramJSONObject)
  {
    // Byte code:
    //   0: iconst_1
    //   1: istore_2
    //   2: ldc 2
    //   4: monitorenter
    //   5: aload_1
    //   6: ldc 60
    //   8: invokevirtual 50	org/json/JSONObject:optString	(Ljava/lang/String;)Ljava/lang/String;
    //   11: astore 4
    //   13: aload_0
    //   14: ldc 73
    //   16: iconst_0
    //   17: invokevirtual 79	android/content/Context:getSharedPreferences	(Ljava/lang/String;I)Landroid/content/SharedPreferences;
    //   20: astore 5
    //   22: new 14	org/json/JSONArray
    //   25: dup
    //   26: aload 5
    //   28: aload 4
    //   30: aconst_null
    //   31: invokeinterface 134 3 0
    //   36: invokespecial 112	org/json/JSONArray:<init>	(Ljava/lang/String;)V
    //   39: astore 6
    //   41: ldc 207
    //   43: aload_1
    //   44: ldc 44
    //   46: invokevirtual 211	org/json/JSONObject:opt	(Ljava/lang/String;)Ljava/lang/Object;
    //   49: invokevirtual 36	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   52: ifeq +137 -> 189
    //   55: new 105	com/umeng/fb/b
    //   58: dup
    //   59: aload 6
    //   61: invokespecial 115	com/umeng/fb/b:<init>	(Lorg/json/JSONArray;)V
    //   64: astore 8
    //   66: iconst_m1
    //   67: aload 6
    //   69: invokevirtual 18	org/json/JSONArray:length	()I
    //   72: iadd
    //   73: istore 9
    //   75: goto +215 -> 290
    //   78: new 14	org/json/JSONArray
    //   81: dup
    //   82: aload 5
    //   84: aload 4
    //   86: aconst_null
    //   87: invokeinterface 134 3 0
    //   92: invokespecial 112	org/json/JSONArray:<init>	(Ljava/lang/String;)V
    //   95: astore 10
    //   97: aload 10
    //   99: aload_1
    //   100: invokevirtual 151	org/json/JSONArray:put	(Ljava/lang/Object;)Lorg/json/JSONArray;
    //   103: pop
    //   104: aload 5
    //   106: aload 4
    //   108: aload 10
    //   110: invokevirtual 155	org/json/JSONArray:toString	()Ljava/lang/String;
    //   113: invokestatic 178	com/umeng/fb/util/c:a	(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;)V
    //   116: ldc 2
    //   118: monitorexit
    //   119: iload_2
    //   120: ireturn
    //   121: aload 6
    //   123: iload 9
    //   125: invokevirtual 40	org/json/JSONArray:getJSONObject	(I)Lorg/json/JSONObject;
    //   128: ldc 213
    //   130: aconst_null
    //   131: invokevirtual 215	org/json/JSONObject:optString	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   134: astore 12
    //   136: aload_1
    //   137: ldc 213
    //   139: aconst_null
    //   140: invokevirtual 215	org/json/JSONObject:optString	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   143: astore 13
    //   145: aload 12
    //   147: ifnull +36 -> 183
    //   150: aload 12
    //   152: aload 13
    //   154: invokevirtual 54	java/lang/String:equalsIgnoreCase	(Ljava/lang/String;)Z
    //   157: ifeq +26 -> 183
    //   160: aload_0
    //   161: aload 8
    //   163: iload 9
    //   165: invokestatic 217	com/umeng/fb/util/c:a	(Landroid/content/Context;Lcom/umeng/fb/b;I)V
    //   168: goto -90 -> 78
    //   171: astore 7
    //   173: aload 7
    //   175: invokevirtual 67	java/lang/Exception:printStackTrace	()V
    //   178: iconst_0
    //   179: istore_2
    //   180: goto -64 -> 116
    //   183: iinc 9 255
    //   186: goto +104 -> 290
    //   189: aload_0
    //   190: ldc 219
    //   192: iconst_0
    //   193: invokevirtual 79	android/content/Context:getSharedPreferences	(Ljava/lang/String;I)Landroid/content/SharedPreferences;
    //   196: astore 14
    //   198: aload 14
    //   200: aload 4
    //   202: ldc 221
    //   204: invokeinterface 134 3 0
    //   209: astore 15
    //   211: aload_1
    //   212: ldc 213
    //   214: invokevirtual 50	org/json/JSONObject:optString	(Ljava/lang/String;)Ljava/lang/String;
    //   217: astore 16
    //   219: aload 15
    //   221: aload 16
    //   223: invokestatic 226	com/umeng/fb/util/a:a	(Ljava/lang/String;Ljava/lang/String;)Z
    //   226: ifne -48 -> 178
    //   229: aload_1
    //   230: ldc 228
    //   232: invokestatic 230	com/umeng/common/b/g:a	()Ljava/lang/String;
    //   235: invokevirtual 233	org/json/JSONObject:put	(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
    //   238: pop
    //   239: aload 6
    //   241: aload_1
    //   242: invokevirtual 151	org/json/JSONArray:put	(Ljava/lang/Object;)Lorg/json/JSONArray;
    //   245: pop
    //   246: aload 5
    //   248: aload 4
    //   250: aload 6
    //   252: invokevirtual 155	org/json/JSONArray:toString	()Ljava/lang/String;
    //   255: invokestatic 178	com/umeng/fb/util/c:a	(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;)V
    //   258: aload 14
    //   260: aload 4
    //   262: aload 16
    //   264: invokestatic 178	com/umeng/fb/util/c:a	(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;)V
    //   267: aload_0
    //   268: ldc 163
    //   270: iconst_0
    //   271: invokevirtual 79	android/content/Context:getSharedPreferences	(Ljava/lang/String;I)Landroid/content/SharedPreferences;
    //   274: ldc 235
    //   276: aload 16
    //   278: invokestatic 178	com/umeng/fb/util/c:a	(Landroid/content/SharedPreferences;Ljava/lang/String;Ljava/lang/String;)V
    //   281: goto -165 -> 116
    //   284: astore_3
    //   285: ldc 2
    //   287: monitorexit
    //   288: aload_3
    //   289: athrow
    //   290: iload 9
    //   292: ifge -171 -> 121
    //   295: goto -217 -> 78
    //
    // Exception table:
    //   from	to	target	type
    //   22	75	171	java/lang/Exception
    //   78	116	171	java/lang/Exception
    //   121	145	171	java/lang/Exception
    //   150	168	171	java/lang/Exception
    //   189	281	171	java/lang/Exception
    //   5	22	284	finally
    //   22	75	284	finally
    //   78	116	284	finally
    //   121	145	284	finally
    //   150	168	284	finally
    //   173	178	284	finally
    //   189	281	284	finally
  }

  public static void c(Context paramContext, String paramString)
  {
    monitorenter;
    try
    {
      paramContext.getSharedPreferences("feedback", 0).edit().remove(paramString).commit();
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  public static void c(Context paramContext, JSONObject paramJSONObject)
  {
    monitorenter;
    try
    {
      b.d(paramJSONObject);
      e(paramContext, paramJSONObject);
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  private static String d(Context paramContext, String paramString)
  {
    SharedPreferences localSharedPreferences;
    String str;
    monitorenter;
    try
    {
      localSharedPreferences = paramContext.getSharedPreferences("UmengFb_Nums", 0);
      str = localSharedPreferences.getString("newReplyIds", "");
      boolean bool = str.contains(paramString);
      if (bool)
        return str;
      str = str + "," + paramString;
    }
    finally
    {
      monitorexit;
    }
  }

  public static void d(Context paramContext, JSONObject paramJSONObject)
  {
    monitorenter;
    try
    {
      b.c(paramJSONObject);
      e(paramContext, paramJSONObject);
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  public static boolean e(Context paramContext, JSONObject paramJSONObject)
  {
    String str1;
    SharedPreferences localSharedPreferences;
    String str2;
    monitorenter;
    try
    {
      str1 = paramJSONObject.optString("feedback_id");
      label63: str2 = localSharedPreferences.getString(str1, "[]");
    }
    finally
    {
      int i;
      try
      {
        JSONArray localJSONArray = new JSONArray(str2);
        localJSONArray.put(paramJSONObject);
        a(localSharedPreferences, str1, localJSONArray.toString());
        i = 1;
        monitorexit;
        return i;
      }
      catch (JSONException localJSONException)
      {
        localJSONException.printStackTrace();
        i = 0;
        break label63:
        localObject = finally;
        monitorexit;
        throw localObject;
      }
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     com.umeng.fb.util.c
 * JD-Core Version:    0.5.2
 */